import type {
  DepartData,
  OrderParams,
  OrderPreData,
  OrderPreParams,
  PayParams,
  UploadData,
} from '@/types/consult'
import { http } from '@/utils/http'

/**
 * 医生科室列表
 */
export const departmentListApi = () => {
  return http.get<null, DepartData[]>('/dep/all')
}

/**
 * 上传图片
 */
export const uploadImageApi = (filePath: string) => {
  return http.upload<null, UploadData>('/upload', {
    name: 'file',
    filePath: filePath,
  })
}

/**
 * 生成预支付订单
 */
export const preOrderApi = (params: OrderPreParams) => {
  return http.get<null, OrderPreData>('/patient/consult/order/pre', {
    params,
  })
}

/**
 * 生成待支付订单
 */
export const createOrderApi = (data: OrderParams) => {
  return http.post<null, { id: string }>('/patient/consult/order', data)
}

/**
 * 三方支付（暂时只支持支付宝支付）
 */
export const orderPayApi = (data: PayParams) => {
  return http.post<null, { payUrl: string }>('/patient/consult/pay', data)
}
